package com.whm.hrmanagement.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.whm.hrmanagement.domain.OaStaffAttendance;
import com.whm.hrmanagement.domain.OaStaffQj;
import com.whm.hrmanagement.domain.dto.OaStaffQjInfoDto;
import com.whm.hrmanagement.domain.dto.OaStaffSalaryDto;
import com.whm.hrmanagement.domain.vo.OaStaffQjVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 员工请假Mapper接口
 * 
 * @author whm
 * @date 2024-02-05
 */
public interface OaStaffQjMapper  extends BaseMapper<OaStaffQj>
{
    /**
     * 查询员工请假
     * 
     * @param id 员工请假主键
     * @return 员工请假
     */
    public OaStaffQj selectOaStaffQjById(Long id);

    /**
     * 查询员工请假列表
     * 
     * @param oaStaffQj 员工请假
     * @return 员工请假集合
     */






    List<OaStaffQj> selectOaStaffQjList(OaStaffQj oaStaffQj);

    @Select("select aa.id,aa.days,aa.type_num,aa.start_date,aa.create_time,aa.status,aa.remark,ss.user_id code,ss.nick_name name,ss.phonenumber phone,sd.dept_name deptName from oa_staff_qj aa LEFT join sys_user ss on aa.staff_id = ss.user_id LEFT join sys_dept sd on ss.dept_id = sd.dept_id where aa.status != #{status} and ss.nick_name like concat('%',#{name},'%')")
    List<OaStaffQjInfoDto>  listStaffLeaveVO( @Param("status") Integer status, @Param("name") String name);

    @Select("    select aa.id,aa.days,aa.type_num,aa.start_date,aa.create_time,aa.status,aa.remark,ss.user_id code,ss.nick_name name,ss.phonenumber phone,sd.dept_name deptName from oa_staff_qj aa LEFT join sys_user ss on aa.staff_id = ss.user_id LEFT join sys_dept sd on ss.dept_id = sd.dept_id where ss.dept_id = #{deptId} and aa.status != #{status} and ss.nick_name like concat('%',#{name},'%')")
    List<OaStaffQjInfoDto>  listStaffDeptLeaveVO(@Param("status") Integer status, @Param("name") String name,@Param("deptId") Long deptId);









    /**
     * 新增员工请假
     * 
     * @param oaStaffQj 员工请假
     * @return 结果
     */
    public int insertOaStaffQj(OaStaffQj oaStaffQj);

    /**
     * 修改员工请假
     * 
     * @param oaStaffQj 员工请假
     * @return 结果
     */
    public int updateOaStaffQj(OaStaffQj oaStaffQj);

    /**
     * 删除员工请假
     * 
     * @param id 员工请假主键
     * @return 结果
     */
    public int deleteOaStaffQjById(Long id);

    /**
     * 批量删除员工请假
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteOaStaffQjByIds(Long[] ids);


}
